package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.springframework.boot.autoconfigure.cache.CacheProperties;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    void updateNumberById(ShoppingCart shoppingCart);

    /**
     * 插入购物车数据
     * @param shoppingCart
     */
    void insert(ShoppingCart shoppingCart);

    /**
     * 根据当前用户id清空购物车
     * @param currentId
     */
    @Delete("delete from shopping_cart where user_id=#{currenId}")
    void delete(Long currentId);

    /**
     * 批量向购物车中插入信息
     * @param shoppingCart
     */
    void insertBanch(List<ShoppingCart> shoppingCart);
}
